#include <abstract/attribute.h>
#include "ut.h"
#include <stdio.h>

Attr *a = NULL;

void test_int();
void test_str();
void test_float();

TestDesc attr_tests[] = {
    { "int attr", test_int },
    { "str attr", test_str },
    { "float attr", test_float},
    { NULL, NULL },
};


void test_int() {
    a = attr_int(44);
    ASSERT( (a!=NULL), "create int attr" );
    ASSERT_EQI( int_value(a), 44, "int_value" );
    attr_destroy(a);
}

void test_str() {
    a = attr_str("fourty-and-four");
    ASSERT( (a!=NULL), "create str atttr" );
    ASSERT_EQS( str_value(a), "fourty-and-four", "str_value");
    attr_destroy(a);
}

void test_float() {
    a = attr_float(4.4f);
    ASSERT( (a!=NULL), "create float attr" );
    ASSERT_EQI( (int)(float_value(a) * 10), 44, "float_value" );
    attr_destroy(a);
}

